<?php
/**
 *
 * @Author nikm $
 *
 * @Date 2012-05-03 $
 */

define('FROM_INDEX', true);
define('ROOT_PATH', substr(dirname(__FILE__), 0, -8) . '/');

require_once (ROOT_PATH."include/common.inc.php");
require_once(ROOT_PATH."include/wap.inc.php");

//error_reporting(E_ERROR);
error_reporting(E_ALL|E_NOTICE);
ini_set('display_errors', 'on');

require ROOT_PATH.'servlet/function/load_setting.php';
load_setting('default');

require ROOT_PATH.'servlet/function/common.func.php';
require ROOT_PATH.'servlet/function/cache.func.php';

date_default_timezone_set('Asia/Shanghai');
header("Content-Type: text/html; charset=utf-8");

$request = $_REQUEST;

$request['start_time'] = microtime(true);

//Request is invalid
if(!validate_request($_POST)) show_msg($request, 'g_01', STATUS_E);

// Available modules
$mods = array('article'=>1, 'feedback'=>1);

$mod = isset($request['m']) ? $request['m'] : '';
$act = isset($request['a']) ? $request['a'] : '';

$mod_file = ROOT_PATH.'servlet/module/'.$mod.'.mod.php';
// Module does not exists
if(!isset($mods[$mod]) || !$mods[$mod] || !file_exists($mod_file))
{
	show_msg($request, 'g_03', STATUS_E);
}

require_once $mod_file;
$module = new moduleObj($request);